package com.digitalchina.lxnsy.activity.old;

import android.content.Intent;
import android.widget.EditText;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.base.BaseActivity;
import com.digitalchina.lxnsy.toolkit.StringUtil;

import butterknife.Bind;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.activity
 * 创建人：白彦东
 * 创建时间：2017/2/20 17:16
 * 修改备注：
 * ================================================
 */

public class TrainingInfoUpdateActivity extends BaseActivity {

    @Bind(R.id.training_update_tv_tips)
    TextView trainingUpdateTvTips;
    @Bind(R.id.training_update_et_content)
    EditText trainingUpdateEtContent;

    public static final int UPDATE_RESULT_NAME_CODE = 1000;
    public static final int UPDATE_RESULT_PERSON_CODE = 1001;

    private String updateWhat = "";

    @Override
    public void setLayout() {
        setTitle("信息修改");
        setRightText("保存");
        setContentLayout(R.layout.activity_training_info_update);
    }

    @Override
    public void initMember() {
        if (getIntent().hasExtra("training")) {

            updateWhat = (String) getIntent().getSerializableExtra("training");

            if (updateWhat.equals("name"))
                trainingUpdateTvTips.setText("编辑培训名称");
            else
                trainingUpdateTvTips.setText("编辑培训人");
        }
    }

    @Override
    public void addListener() {

    }

    @Override
    public void setHandler() {

    }

    @Override
    public void callBack(Object object) {

    }

    @Override
    public void rightOnClick() {
        Intent intent = new Intent();
        intent.putExtra("update", StringUtil.getEditText(trainingUpdateEtContent));
        if (updateWhat.equals("name")) {
            setResult(UPDATE_RESULT_NAME_CODE, intent);
        } else if (updateWhat.equals("person")) {
            setResult(UPDATE_RESULT_PERSON_CODE, intent);
        }
        finish();
    }

}
